<?php 
class HeaderSearchFirms extends CWidget {
 
	/*
    public function init()    {     
    }
    */	
    
    public function run() {
        $model = new SearchFirmsForm;
        $key = get_class($model);
        //$model->unsetAttributes();
        
        if (isset($_POST[$key])) {
            Yii::app()->session[$key] = $_POST[$key];
            $model->attributes = $_POST[$key];
        } else {
            if (isset(Yii::app()->session[$key])) {
                $model->attributes = Yii::app()->session[$key];
            } 
        }
        
		$this->render('headerSearchFirms', array(
			'model' => $model,
		));    
    }
    
    
	/*
	protected function getImgSrc($name, $path_part, $mode = 'thumb',$useDefault = true) {
		$web_path = Yii::app()->getBaseUrl(true);
		$real_path = Yii::getPathOfAlias('webroot');
		$src = $web_path.'/images/noimage-100.png';
		if ('' == $name) return $src;
		$tmp_src = '';
	    switch($mode) {
    		case 'thumb':
    		default:
    			$tmp_src = $path_part.Yii::app()->params->image_thumb_key.$name;
    		break;
    		case 'image':
    			$tmp_src = $path_part.'img_'.$name;
    		break;	
    		case 'orig':
    			$tmp_src = $path_part.$name;
    		break;
    	}
    	if ('' == $tmp_src) {
    		return ($useDefault) ? $src : '';	
    	}
    	if (!file_exists($real_path.$tmp_src)) {
    		return ($useDefault) ? $src : '';	
    	}
		return $web_path.$tmp_src;
	}    
    */
}


?>